//
//  XPPAutoAccessorizer.m
//  XPPXcodePlugin
//
//  Created by yoyokko on 10-8-17.
//  Copyright 2010 yoyokko@gmail.com. All rights reserved.
//

#import "XPPAutoAccessorizer.h"


@implementation XPPAutoAccessorizer

@synthesize mainWindow = mainWindow_;
@synthesize classNames = classNames_;

- (id) init
{
	if (self = [super init])
	{
		[NSBundle loadNibNamed:@"XPPAutoAccessorizer" owner:self];
		
		NSButton *closeButton = [self.mainWindow standardWindowButton:NSWindowCloseButton];
		[closeButton setTarget:self];
		[closeButton setAction:@selector(closeAccessorizerWindow:)];
	}
	return self;
}

- (void) closeAccessorizerWindow:(id) sender
{
	NSInteger result = NSRunAlertPanel(@"Warning", @"Do you want to close this window?", @"YES", @"NO", nil);
	if (result == NSOKButton) 
	{
		[self.mainWindow close];
		[NSApp stopModal];
	}
}

- (void) dealloc
{
	self.mainWindow = nil;
	[super dealloc];
}

@end
